import axios from '../axios/index.js'
//内容列表全部文章
export const articalList = () => {
    return axios.get('/mp/v1_0/articles')
}
//点击页面
// export const articalClickPage = ({ page, per_page }) => {
//     return axios.get('/mp/v1_0/articles', {
//         params: {
//             page,
//             per_page
//         }
//     })
// }

//获取全部频道
export const channelList = () => {
    return axios.get('/mp/v1_0/channels')
}

//按钮筛选
export const articalChoose = ({ status, channel_id, begin_pubdate, end_pubdate, page, per_page }) => {
    return axios.get('/mp/v1_0/articles', {
        params: {
            status,
            channel_id ,
            begin_pubdate,
            end_pubdate,
            page,
            per_page
        }
    })

}

//删除文章
export const articalDel = (id) => {
    axios.delete(`/mp/v1_0/articles/${id}`)
}
//发表文章

export const pushArt = ({ title, content, cover, channel_id }) => {
    axios.post('/mp/v1_0/articles', {
        title,
        content,
        cover,
        channel_id
    })
}

//发表文章
export const pushArtical = ({ title, content, cover, channel_id }) => {
    return axios.post('/mp/v1_0/articles', {
        title,
        content,
        cover,
        channel_id
    })
}

//根据id获取文章
export const idArtical = (id) => {
    return axios.get(`/mp/v1_0/articles/${id}`)
}

//修改文章
export const changeArt = (id, { title, content, cover, channel_id }) => {
    return axios.put(`/mp/v1_0/articles/${id}`, {
        title,
        content,
        cover,
        channel_id
    })
}